home *** CD-ROM | disk | FTP | other *** search
- MP(3C) Last changed: 4-9-99
-
-
- NNAAMMEE
- mmpp, mmpp__bblloocckk, mmpp__bblloocckkttiimmee, mmpp__ccrreeaattee, mmpp__ddeessttrrooyy, mmpp__mmyy__tthhrreeaaddnnuumm,
- mmpp__nnuummtthhrreeaaddss, mmpp__sseett__nnuummtthhrreeaaddss, mmpp__sseettuupp, mmpp__uunnbblloocckk, mmpp__sseettlloocckk,
- mmpp__ssuuggggeesstteedd__nnuummtthhrreeaaddss, mmpp__uunnsseettlloocckk, mmpp__bbaarrrriieerr,
- mmpp__iinn__ddooaaccrroossss__lloooopp, mmpp__sseett__ssllaavvee__ssttaacckkssiizzee - C multiprocessing
- utility functions
-
- SSYYNNOOPPSSIISS
- vvooiidd mmpp__bblloocckk(())
-
- vvooiidd mmpp__uunnbblloocckk(())
-
- vvooiidd mmpp__bblloocckkttiimmee((_i_t_e_r_s))
- iinntt _i_t_e_r_s
-
- vvooiidd mmpp__sseettuupp(())
-
- vvooiidd mmpp__ccrreeaattee((_n_u_m))
- iinntt _n_u_m
-
- vvooiidd mmpp__ddeessttrrooyy(())
-
- iinntt mmpp__nnuummtthhrreeaaddss(())
-
- vvooiidd mmpp__sseett__nnuummtthhrreeaaddss((_n_u_m))
- iinntt _n_u_m
-
- iinntt mmpp__mmyy__tthhrreeaaddnnuumm(())
-
- iinntt mmpp__iiss__mmaasstteerr(())
-
- vvooiidd mmpp__sseettlloocckk(())
-
- vvooiidd mmpp__uunnsseettlloocckk(())
-
- vvooiidd mmpp__bbaarrrriieerr(())
-
- iinntt mmpp__iinn__ddooaaccrroossss__lloooopp(())
-
- vvooiidd mmpp__sseett__ssllaavvee__ssttaacckkssiizzee((_s_i_z_e))
- iinntt _s_i_z_e
-
- uunnssiiggnneedd iinntt mmpp__ssuuggggeesstteedd__nnuummtthhrreeaaddss((_n_u_m))
- uunnssiiggnneedd iinntt _n_u_m
-
- IIMMPPLLEEMMEENNTTAATTIIOONN
- IRIX systems
-
- DDEESSCCRRIIPPTTIIOONN
- The following routines control the parallelism used in C programs.
- Although not needed by most users, they help to tune specific
- applications.
-
- mmpp__bblloocckk
- Puts all slave threads to sleep via bblloocckkpprroocc(2). This frees the
- processors for use by other jobs. This is useful if it is known
- that the slaves will not be needed for some time, and the machine
- is being shared by several users. Calls to mmpp__bblloocckk may not be
- nested; a warning is issued if an attempt to do so is made.
-
- mmpp__uunnbblloocckk
- Wakes up the slave threads that were previously blocked via
- mmpp__bblloocckk. It is an error to unblock threads that are not
- currently blocked; a warning is issued if an attempt is made to
- do so.
-
- It is not necessary to explicitly call mmpp__uunnbblloocckk. When a
- parallel region is entered, a check is made, and if the slaves
- are currently blocked, a call is made to mmpp__uunnbblloocckk
- automatically.
-
- mmpp__bblloocckkttiimmee
- Controls the amount of time a slave thread waits for work before
- giving up. When enough time has elapsed, the slave thread blocks
- itself. This automatic blocking is independent of the user level
- blocking provided by the mmpp__bblloocckk/mmpp__uunnbblloocckk calls. Slave
- threads that have blocked themselves will be automatically
- unblocked upon entering a parallel region. The argument to
- mmpp__bblloocckkttiimmee is the number of times to spin in the wait loop. By
- default, it is set to 10,000,000. This takes about .25 seconds
- on a 200MHz processor. As a special case, an argument of 0
- disables the automatic blocking, and the slaves will spin wait
- without limit. The environment variable MMPP__BBLLOOCCKKTTIIMMEE may be set
- to an integer value. It acts like an implicit call to
- mmpp__bblloocckkttiimmee during program startup.
-
- mmpp__ddeessttrrooyy
- Deletes the slave threads. They are stopped by forcing them to
- call eexxiitt(2). An alternative is to specify mmpp__bblloocckk.
-
- mmpp__ccrreeaattee
- Creates and initializes threads. It creates enough threads so
- that the total number is equal to the argument. Because the
- calling thread counts as one, mmpp__ccrreeaattee will create one less than
- its argument in new slave threads.
-
- mmpp__sseettuupp
- Also creates and initializes threads. It takes no arguments. It
- simply calls mmpp__ccrreeaattee using the current default number of
- threads. Usually, the default number is equal to the number of
- CPUs currently on the machine. If the user has not already
- called either of the thread creation routines, then mmpp__sseettuupp is
- invoked automatically when the first parallel region is entered.
- If the MMPP__SSEETTUUPP environment variable is set, then mmpp__sseettuupp is
- called during initialization, before any user code is executed.
-
- mmpp__nnuummtthhrreeaaddss
- Returns the number of threads that would participate in an
- immediately following parallel region. If the threads have
- already been created, then it returns the current number of
- threads. If the threads have not been created, then it returns
- the current default number of threads. The count includes the
- master thread. Knowing this count can be useful in optimizing
- certain kinds of parallel loops by hand, but this function has
- the side-effect of freezing the number of threads to the returned
- value. As a result, this routine should be used sparingly. To
- determine the number of threads without this side-effect, see the
- following description of mmpp__ssuuggggeesstteedd__nnuummtthhrreeaaddss.
-
- mmpp__sseett__nnuummtthhrreeaaddss
- Sets the current default number of threads to the specified
- value. Note that this call does not directly create the threads,
- it only specifies the number that a subsequent mmpp__sseettuupp call
- should use. If the MMPP__SSEETT__NNUUMMTTHHRREEAADDSS environment variable is
- set, it acts like an implicit call to mmpp__sseett__nnuummtthhrreeaaddss during
- program startup. For convenience when operating among several
- machines with different numbers of CPUs, MMPP__SSEETT__NNUUMMTTHHRREEAADDSS can be
- set to an expression involving integer literals, the binary
- operators + and -, the binary functions min and max, and the
- special AALLLL symbolic value, which stands for "the total number of
- available CPUs on the current machine." Thus, the following
- example would set the number of threads to seven:
-
- setenv MP_SET_NUMTHREADS 7
-
- The following example sets the number of threads on a 4 CPU machine to
- be one less than the number of CPUs on the current machine (but always
- at least one):
-
- setenv MP_SET_NUMTHREADS "max(1,all-1)"
-
- If your configuration includes some machines with large numbers of
- CPUs, it is helpful to set an upper bound. The following example will
- request (no more than) 4 CPUs:
-
- setenv MP_SET_NUMTHREADS "min(all,4)"
-
- For compatibility with earlier releases, NNUUMM__TTHHRREEAADDSS is supported as a
- synonym for MMPP__SSEETT__NNUUMMTTHHRREEAADDSS.
-
- mmpp__mmyy__tthhrreeaaddnnuumm
- Returns an integer between 0 and _n-1 where _n is the value
- returned by mmpp__nnuummtthhrreeaaddss. The master process is always thread
- 0. This is occasionally useful for optimizing certain kinds of
- loops by hand.
-
- mmpp__iiss__mmaasstteerr
- Returns 1 if called by the master process, otherwise 0 is
- returned..
-
- mmpp__sseettlloocckk
- Provides convenient (though limited) access to the locking
- routines. The convenience is that no set up is required; it may
- be called directly without any preliminaries. The limitation is
- that there is only one lock. It is analogous to the
- uusssseettlloocckk(3P) routine, but it takes no arguments and does not
- return a value. This is useful for serializing access to shared
- variables (e.g. counters) in a parallel region. Note that it
- will frequently be necessary to declare those variables as
- vvoollaattiillee to ensure that the optimizer does not assign them to a
- register.
-
- mmpp__uunnsseettlloocckk
- The companion routine for mmpp__sseettlloocckk. It also takes no arguments
- and does not return a value.
-
- mmpp__bbaarrrriieerr
- Provides a simple interface to a single bbaarrrriieerr(3P). It may be
- used inside a parallel loop to force a barrier synchronization to
- occur among the parallel threads. The routine takes no
- arguments, returns no value, and does not require any
- initialization.
-
- mmpp__iinn__ddooaaccrroossss__lloooopp
- Answers the question "Am I currently executing inside a parallel
- loop?" This is useful in certain rare situations where you have
- an external routine that can be called both from inside a
- parallel loop and also from outside a parallel loop, and the
- routine must do different things depending on whether or not it
- is being called in parallel.
-
- mmpp__sseett__ssllaavvee__ssttaacckkssiizzee
- Sets the stacksize (in bytes) to be used by the slave processes
- when they are created (via sspprrooccsspp(2)). The default size is
- 16MB. Note that slave processes only allocate their local data
- onto their stack; shared data (even if allocated on the master's
- stack) is not counted.
-
- mmpp__ssuuggggeesstteedd__nnuummtthhrreeaaddss
- Uses the supplied value as a hint about how many threads to use
- in subsequent parallel regions, and returns the previous value of
- the number of threads to be employed in parallel regions. It does
- not affect any currently executing parallel regions. The
- implementation may ignore this hint depending on factors such as
- overall system load. This routine may also be called with the
- value 0, in which case it simply returns the number of threads to
- be employed in parallel regions without the side-effect present
- in mmpp__nnuummtthhrreeaaddss..
-
- ##pprraaggmmaa DDiirreeccttiivveess
- The MIPSpro C and C++ compilers allow you to apply the capabilities of
- a Silicon Graphics multiprocessor computer to the execution of a
- single job. By coding a few simple directives, the compiler splits the
- job into concurrently executing pieces, thereby decreasing the wall-
- clock run time of the job.
-
- Directives enable, disable, or modify a feature of the compiler.
- Essentially, directives are command line options specified within the
- input file instead of on the command line. Unlike command line
- options, directives have no default setting. To invoke a directive,
- you must either toggle it on or set a desired value for its level.
- The following directives can be used in C (and C++) programs when
- compiled with the --mmpp option (see the _M_I_P_S_p_r_o _C _a_n_d _C++ _P_r_a_g_m_a_s manual
- for details on these directives):
-
- * ##pprraaggmmaa ppaarraalllleell
-
- * ##pprraaggmmaa ppffoorr
-
- * ##pprraaggmmaa ccrriittiiccaall
-
- * ##pprraaggmmaa iinnddeeppeennddeenntt
-
- * ##pprraaggmmaa ssyynncchhrroonniizzee
-
- * ##pprraaggmmaa eenntteerr ggaattee
-
- * ##pprraaggmmaa eexxiitt ggaattee
-
- * ##pprraaggmmaa ppaaggee__ppllaaccee
-
- SSEEEE AALLSSOO
- cccc(1), ff7777(1)
-
- mmpp(3f), ssyynncc(3c), ssyynncc(3f)
-
- _C _L_a_n_g_u_a_g_e _R_e_f_e_r_e_n_c_e _M_a_n_u_a_l
-
- _M_I_P_S_p_r_o _F_O_R_T_R_A_N _7_7 _P_r_o_g_r_a_m_m_e_r'_s _G_u_i_d_e
-
- This man page is available only online.
-